package com.usooft.metaTalent.db.system;

import com.usooft.framework.core.query.Page;
import com.usooft.framework.web.auth.RequiresPermission;
import com.usooft.metaTalent.core.system.service.RolePermissionService;
import com.usooft.metaTalent.core.system.wrapper.RolePermissionWrapper;
import com.usooft.metaTalent.db.system.form.RolePermissionListForm;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/system/role-permission")
@RequiredArgsConstructor
public class RolePermissionController {
    private final RolePermissionService rolePermissionService;

    @GetMapping("/list")
    @RequiresPermission(
            value = "/system/role-permission/list",
            description = "角色权限/查询"
    )
    public ResponseEntity<?> list(RolePermissionListForm form) {
        Page<RolePermissionWrapper> page = rolePermissionService.page(form.buildQuery());
        return ResponseEntity.ok(page);
    }
}
